﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using QInfrastructure.Interfaces.SystemManager;
using QInfrastructure.Models.SystemManager;

namespace QInfrastructure.WebCore.Areas.SystemManager.Controllers
{

	[Authorize]
	[Area("SystemManager")]
	public class SystemUserThemeController : QBaseController
	{
		public IActionResult GetCurrentUserTheme(Guid userId)
		{
			if(userId==Guid.Empty) userId=CurrentUser.Id;
			var info=GetService<TSystemUserTheme>().GetSystemUserThemeById(userId);
			return Json(info);
		}
		public IActionResult AddOrUpdateSystemUserTheme(SystemUserTheme theme)
		{
			theme.UserId = CurrentUser.Id;
			GetService<TSystemUserTheme>().AddOrUpdateSystemUserTheme(theme);
			return Success();
		}
	}
}
